import { defineStore } from 'pinia';
import { computed, ref } from 'vue';

export const useInfoStore= defineStore('info',{
  state:()=>({
    count:10,
    title:'info'
  }),
  getters:{
    g1:(state)=>state.title+'hello',
  },
  actions:{
    say(){
      console.log('hello info');
    }
  }
})


export const useShopStore= defineStore('shop',()=>{
  // setup
  const count = ref(200);
  const title = ref('shop');
  const g1 =  computed(()=>{
    return  title.value+' hello'
  });
  function say(){
    console.log('hello shop');
  }
  return {
    count,title,g1,say
  }
})


export const useCartStore= defineStore('shop',{
  state(){
    return {
      title:'hello cart'
    }
  }
})